﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App29"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ViewModels="using:App29.ViewModels"
    x:Class="App29.MainPage" x:Name="page"
    mc:Ignorable="d">
    <Page.Resources>
        <DataTemplate x:Key="StandardItemTemplate">
            <Grid Height="{Binding ItemHeight, ElementName=page, Mode=OneWay}" Width="800" Background="Gray">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Image Source="ms-appx:///Images/Mag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40" />
                <Grid Grid.Column="1">
                    <StackPanel Margin="40">
                        <TextBlock TextWrapping="Wrap" FontSize="38">
							<Run Text="The quick brown fox jumps over the lazy dog"/>
                        </TextBlock>
                        <Grid Background="{Binding Brush}" Height="40" Margin="0,20" />
                        <TextBlock TextWrapping="Wrap" FontSize="24">
							<Run Text="The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog."/>
                        </TextBlock>
                    </StackPanel>
                </Grid>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="SpacerItemTemplate">
            <Grid Height="{Binding ItemHeight, ElementName=page, Mode=OneWay}" Width="800" Background="Transparent" />
        </DataTemplate>
        <Style x:Key="GridViewItemStyle" TargetType="GridViewItem">
            <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
            <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="TabNavigation" Value="Local"/>
            <Setter Property="IsHoldingEnabled" Value="True"/>
            <Setter Property="Margin" Value="0,0,2,2"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="GridViewItem">
                        <GridViewItemPresenter 
                            CheckHintBrush="{ThemeResource ListViewItemCheckHintThemeBrush}" 
                            CheckBrush="{ThemeResource ListViewItemCheckThemeBrush}" 
                            ContentMargin="4" 
                            ContentTransitions="{TemplateBinding ContentTransitions}" 
                            CheckSelectingBrush="{ThemeResource ListViewItemCheckSelectingThemeBrush}" 
                            DragForeground="{ThemeResource ListViewItemDragForegroundThemeBrush}" 
                            DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}" 
                            DragBackground="{ThemeResource ListViewItemDragBackgroundThemeBrush}" 
                            DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}" 
                            FocusBorderBrush="{ThemeResource ListViewItemFocusBorderThemeBrush}" 
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            Padding="{TemplateBinding Padding}" 
                            PointerOverBackgroundMargin="1" 
                            PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" 
                            PointerOverBackground="{x:Null}" 
                            ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" 
                            SelectedPointerOverBorderBrush="{ThemeResource ListViewItemSelectedPointerOverBorderThemeBrush}" 
                            SelectionCheckMarkVisualEnabled="True" 
                            SelectedForeground="{ThemeResource ListViewItemSelectedForegroundThemeBrush}" 
                            SelectedPointerOverBackground="{ThemeResource ListViewItemSelectedPointerOverBackgroundThemeBrush}" 
                            SelectedBorderThickness="{ThemeResource GridViewItemCompactSelectedBorderThemeThickness}" 
                            SelectedBackground="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}" 
                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>

    <Page.DataContext>
        <ViewModels:MainPageViewModel/>
    </Page.DataContext>

    <Grid Background="Black" xmlns:common="using:App29.Common">
        <GridView x:Name="MyGridView" 
                  ItemsSource="{Binding Colors}" 
                  IsItemClickEnabled="True"
                  SelectionMode="None"
                  Loaded="MyGridView_Loaded" 
                  ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                  ItemContainerStyle="{StaticResource GridViewItemStyle}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <ItemsWrapGrid MaximumRowsOrColumns="1" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplateSelector>
                <common:TemplateSelector 
                    DefaultTemplate="{StaticResource StandardItemTemplate}"
                    SpacerTemplate="{StaticResource SpacerItemTemplate}" />
            </ItemsControl.ItemTemplateSelector>
        </GridView>

        <Grid x:Name="GoRightMarker" HorizontalAlignment="Right" VerticalAlignment="Center" Background="Silver" Height="200" Width="200" Opacity=".75">
            <Path Data="M299.134,162.984L334.087,194.984 299.134,226.984 299.134,162.984z" Stretch="Uniform" Fill="#FFFFFFFF" Width="150" Height="150" RenderTransformOrigin="0.5,0.5" IsHitTestVisible="False" />
        </Grid>

        <Grid x:Name="GoLeftMarker" HorizontalAlignment="Left" VerticalAlignment="Center" Background="Silver" Height="200" Width="200" Opacity=".75">
            <Path Data="M582.309,226.984L547.355,194.984 582.309,162.984 582.309,226.984z" Stretch="Uniform" Fill="#FFFFFFFF" Width="150" Height="150" RenderTransformOrigin="0.5,0.5" IsHitTestVisible="False" />
        </Grid>

    </Grid>
</Page>
